package com.chapter_1;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @Author: Timo
 * @Date: 2019/4/29 17:14
 * @Description: 人
 */

public class UserThread extends Thread {
    private final Gate gate;
    private final String myname;
    private final String myAddress;

    public UserThread(Gate gate, String myname, String myAddress) {
        this.gate = gate;
        this.myname = myname;
        this.myAddress = myAddress;
    }

    @Override
    public void run() {
        System.out.println(myname + " BEGIN");
        while (true) {
            gate.pass(myname, myAddress);
        }
    }
}
